package mmc.server.shell.ops.constant;

import mmc.server.shell.*;
import mmc.server.shell.ops.Constant;

public class BracketLayer extends Constant {

    public BracketLayer(String text) throws ShellException {
        super(text);

        if (text.trim().startsWith("(") && text.trim().endsWith(")")) {
            lValue = Shell.getOperationTreeFor(text.trim().substring(1, text.trim().length() - 1));
        } else {
            throw new OperationNotAcceptedException(false, text + " does not contain ( or )");
        }
    }

    @Override
    public double execute() {
        return Util.assignToDouble(lValue.executeComplex());
    }
    
    public Object executeComplex(){
    	return lValue.executeComplex();
    }
    
    public Class<?> getOutputType(){
    	return lValue.getOutputType();
    }
    
    public static boolean hideInDescription(){
    	return true;
    }
}
